function calculateIfCondition(lineIndex, lineArr) {
    const newArr = [...lineArr.slice(0, lineIndex)]
    let nextOne = false;
    let conditions = []
    do {
        const upperLine = newArr.pop()
        if (!upperLine) {
            continue;
        }
        if (nextOne) {
            conditions.push(upperLine)
        }

        if (upperLine.includes('{')) {
            nextOne = true;
        } else if (!upperLine.includes('if')) {
            nextOne = false;
        }
    } while (
        newArr.length > 0
        )
    return conditions
}

module.exports = {calculateIfCondition}